﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Text;
using System.IO;
using System.Xml;
using System.Data;
using Gift.WebApp;
using System.Collections;

using Gift.DAL;
using Gift.Model;


public partial class cn_points_for : BasePage
{
    // Methods
    protected string KeywordsBind()
    {
        string str = "";
        try
        {
            if (base.Request.QueryString["id"] == null)
            {
                return str;
            }
            tbPointsFor oPointsFor = BaseFactory.thePointsFor.GetModel(Convert.ToInt32(base.Request.QueryString["id"]));
            if (oPointsFor != null)
            {
                str = oPointsFor.name;
            }
            if (str != "")
            {
                str = str + "，";
            }
            str = str + "积分兑换，";
        }
        catch
        {
        }
        return str;
    }

    protected void Page_Load(object sender, EventArgs e)
    {
    }

    protected StringBuilder PointsForBind()
    {
        StringBuilder builder = new StringBuilder();
        try
        {
            builder.AppendLine("<div class=\"container exchange\">");
            builder.AppendLine("<h1>积分兑换区</h1>");
            builder.AppendLine("<div class=\"exchange_info\">");
            if (base.Request.QueryString["id"] != null)
            {
                tbPointsFor oPointsFor = BaseFactory.thePointsFor.GetModel(Convert.ToInt32(base.Request.QueryString["id"]));
                if (oPointsFor != null)
                {
                    int countByPointsFor = BaseFactory.thePointsForOrder.GetCountByPointsFor(oPointsFor.id);
                    builder.AppendLine("<div class=\"info\">");
                    builder.AppendLine(string.Concat(new object[] { "<div><img src=\"", oPointsFor.image, "\" alt=\"", oPointsFor.name, "\"/></div>" }));
                    builder.AppendLine("<h6>" + oPointsFor.name + "</h6>");
                    builder.AppendLine(string.Concat(new object[] { "<span><input type=\"submit\" value=\"立即兑换\" onclick=\"pointsFor('",oPointsFor.id, "','", oPointsFor.exchangePoints, "');\" /></span>" }));
                    builder.AppendLine(string.Concat(new object[] { "<p><em>兑换次数:", countByPointsFor, "次</em>所需积分：<strong>",oPointsFor.exchangePoints, "</strong></p>" }));
                    builder.AppendLine("</div>");
                    builder.AppendLine("<div class=\"three\">");
                    builder.AppendLine("<p class=\"top_title\">参数</p>");
                    builder.AppendLine("<h4>" + oPointsFor.name + "</h4>");
                    builder.AppendLine("<div class=\"exchage_content\">" + oPointsFor.descript+ "</div>");
                    builder.AppendLine("</div>");
                }
            }
            builder.AppendLine("</div>");
            builder.AppendLine("</div>");
        }
        catch
        {
        }
        return builder;
    }

}